﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace Wicresoft.EKA.CommonExtensions
{
   public class CleanUpThread
    {
        private ICleanUp _cleanUP;
        private int sleepTime;
        public bool bContinue;

        public CleanUpThread(ICleanUp cleanUP, int sleepTime)
        {
            this._cleanUP = cleanUP;
            this.sleepTime = sleepTime;
            this.bContinue = true;
        }

        public void run()
        {
            while (this.bContinue)
            {
                try
                {
                    Thread.Sleep(this.sleepTime);
                }
                catch (Exception localException)
                {

                }

                this._cleanUP.Clean();
            }
        }
    }
}
